import 'package:get/get.dart';
import 'package:industry_net/base/component/list/section.dart';
import 'package:industry_net/pages/home/search/views/cell.dart';
import 'state.dart';

class SearchController extends GetxController {
  final state = SearchState();
  @override
  void onInit() {
    super.onInit();
    getHistory();
    getHot();
  }

  void getHistory() {
    state.historyList = ['财政补贴', '现代梨园', '田头市场'];
    update();
  }

  void getHot() {
    var sec = SectionModel(
        index: 0,
        itemBuilder: (context, index) {
          return SearchCell(
            index: index,
          );
        },
        items: List.generate(10, (index) => index));
    state.hotSource = [sec];
    update();
  }
}
